package org.cosmact.designer.vxml.gefeditor;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;

/**
 * Help to log informations to PDE Error view.
 * 
 *@author hsieh 234aini@gmail.com
 * 
 */
public class Logger {

    private static Logger instance = null;

    private ILog logger = null;

    private Logger() {
	logger = VxmlGefEditorPlugin.getDefault().getLog();
    }

    public static Logger getInstance() {
	if (instance == null) {
	    instance = new Logger();
	}

	return instance;
    }

    public void log(int severity, String message, Throwable exception) {
	logger.log(new Status(severity, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }

    public void logCancel(String message, Throwable exception) {
	logger.log(new Status(Status.CANCEL, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }

    public void logError(String message, Throwable exception) {
	logger.log(new Status(Status.ERROR, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }

    public void logInfo(String message, Throwable exception) {
	logger.log(new Status(Status.INFO, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }

    public void logOk(String message, Throwable exception) {
	logger.log(new Status(Status.OK, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }

    public void logWarning(String message, Throwable exception) {
	logger.log(new Status(Status.WARNING, VxmlGefEditorPlugin.PLUGIN_ID,
		Status.OK, message, exception));
    }
}